﻿using FaceWebServer.Interface;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;

namespace FC8280TServer.Controllers
{
    [Route("[controller]")]
    [ApiController]
    public class SystemMenuController : ControllerBase
    {
        private readonly ILogger<SystemMenuController> _logger;

        private ISystemMenuService _SystemMenu;

        public SystemMenuController(ILogger<SystemMenuController> logger, ISystemMenuService record)
        {
            _logger = logger;
            _SystemMenu = record;
        }



        /// <summary>
        /// 设备主动往云端实时上传打卡记录
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        [Route("GetSystemMenu")]
        [HttpGet]
        public JsonResult GetSystemMenu()
        {
            _logger.LogInformation($"获取系统菜单");

            return new JsonResult(_SystemMenu.GetSystemMenu());
        }

        [Route("GCMemory")]
        [HttpGet]
        public JsonResult GCMemory()
        {
            GC.Collect();

            return new JsonResult( GC.GetGCMemoryInfo());
        }

    }
}
